import java.util.Scanner;

public class PasswordStrengthChecker {
    public void checkPassword(String password){
        if (isWeakPassword(password)) {
            System.out.println("密码强度：弱强度");
        } else if (isMediumPassword(password)) {
            System.out.println("密码强度：中强度");
        } else if (isStrongPassword(password)) {
            System.out.println("密码强度：高强度");
        } else {
            System.out.println("密码强度：未知");
        }
    }

    private static boolean isWeakPassword(String password) {
        int length = password.length();
        if (length < 8 || length >= 8 && (isAllNumeric(password) || isAllAlphabetic(password))) {
            return true;
        }
        return false;
    }

    private static boolean isMediumPassword(String password) {
        int length = password.length();
        if (length >= 8 && containsNumeric(password) && containsAlphabetic(password)) {
            return true;
        }
        return false;
    }

    private static boolean isStrongPassword(String password) {
        int length = password.length();
        if (length >= 8 && containsNumeric(password) && containsLowerCase(password) && containsUpperCase(password)) {
            return true;
        }
        return false;
    }

    private static boolean isAllNumeric(String password) {
        return password.matches("[0-9]+");
    }

    private static boolean isAllAlphabetic(String password) {
        return password.matches("[a-zA-Z]+");
    }

    private static boolean containsNumeric(String password) {
        return password.matches(".*\\d+.*");
    }

    private static boolean containsAlphabetic(String password) {
        return password.matches(".*[a-zA-Z]+.*");
    }

    private static boolean containsLowerCase(String password) {
        return password.matches(".*[a-z]+.*");
    }

    private static boolean containsUpperCase(String password) {
        return password.matches(".*[A-Z]+.*");
    }
}